<?php
$request=$_SERVER['REQUEST_METHOD'];
 $databasehost="localhost";
 $databasename="travIT";
 $databasetable="storesInformation";
 $databaseusername="root";
 $databasepassword="root";

if($request=="GET"){
global $databasehost,$databasename,$databaseusername,$databasepassword,$databasetable;

$nameOfStore=$_GET['storeName'];
$storeCity=$_GET['storeCity'];
//echo ":".$nameOfStore.":";
//echo ":".$storeCity.":";
$con=mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
if(!isset($nameOfStore)|| empty($nameOfStore)){
$query="SELECT * FROM $databasetable WHERE upper(StoreCity)=upper('$storeCity')";
}
else if(!isset($storeCity) || empty($storeCity)){
$query="SELECT * FROM $databasetable WHERE upper(StoreName)=upper('$nameOfStore')";
}
else{
$query="SELECT * FROM $databasetable WHERE upper(StoreName)=upper('$nameOfStore') AND upper(StoreCity)=upper('$storeCity')";
}
$result=mysql_query($query);
//$row=mysql_fetch_array($result);
//echo mysql_num_rows($result)."...";
//$output=mysql_fetch_assoc($result);
while($output=mysql_fetch_array($result)){
echo $output['StoreName']."-";
echo $output['StoreAddress'].",";
echo $output['StoreCity'].",";
echo $output['StoreState'].",";
echo $output['StoreZipCode'].";";
//echo "<br>";
	}
}
?>